Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] Classification 2/n #1143

Merged
merged 90 commits into from
Jul 15, 2022

Conversation

SkafteNicki
Copy link
Member

@SkafteNicki SkafteNicki commented Jul 13, 2022

What does this PR do?

Continues work on classification refactor #1001
Prior work: #1054

This PR takes care of CohenKappa, JaccardIndex and MatthewsCorrCoef which all are subclassed from ConfusionMatrix.

Before submitting

  • Was this discussed/approved via a Github issue? (no need for typos and docs improvements)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure to update the docs?
  • Did you write any new necessary tests?

PR review

Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

Did you have fun?

Make sure you had fun coding 🙃

@SkafteNicki SkafteNicki mentioned this pull request Jul 15, 2022
4 tasks
@mergify mergify bot added the ready label Jul 15, 2022
docs/source/classification/jaccard_index.rst Show resolved Hide resolved

Accepts the following input tensors:

- ``preds`` (int or float tensor): ``(N, C, ...)``. If preds is a floating point tensor with values outside
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``preds`` (int or float tensor): ``(N, C, ...)``. If preds is a floating point tensor with values outside
- ``preds``: ``(N, C, ...)``. If preds is a floating point tensor with values outside

this shall come from function footprint, right so I may skip it...
in case we have it elsewhere, lets prune/simplify in another PR package-wide

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it clear from the function footprint? That basically just states that this is a tensor.
Maybe it is not as important for multilabel, but for multiclass it is quite important to state this since the dtype is dependent on the shape and vice versa
https://github.com/Lightning-AI/metrics/blob/4c7de2257e4f4b58be6738271d79fa67c505ea9f/src/torchmetrics/classification/jaccard.py#L106-L108

@SkafteNicki SkafteNicki merged commit 087acad into devel/classification Jul 15, 2022
@SkafteNicki SkafteNicki deleted the refactor/classification_2 branch July 15, 2022 11:52
@SkafteNicki SkafteNicki mentioned this pull request Aug 5, 2022
4 tasks
@SkafteNicki SkafteNicki mentioned this pull request Aug 20, 2022
4 tasks
Borda added a commit that referenced this pull request Aug 26, 2022
* base structure

* bincount

* binary

* files

* stat score

* multiclass + multilabel confmat

* update

* stat_score

* change bincount

* move back

* del tests

* rest of structure

* confmat working

* working binary stat scores

* full testing

* update

* update

* add missing tests

* update

* multilabel stat scores

* disable old testing

* more testing

* flaky tests

* changelog

* refactor

* class interface

* fixes

* typing

* update

* fix tests

* Update src/torchmetrics/functional/classification/confusion_matrix.py

* missing literal

* add docstring to functional confusion matrix

* add docstring to modular confusion matrix

* add docstring to functional stat scores

* add docstring to modular stat scores

* make private

* docs

* fix mypy and doctests

* fix docs formatting

* literal backwards

* custom movedim

* docs

* inits

* fix

* fix mistakes

* working cohen kappa

* Delete speed.py

* cohen kappa done

* working matthews

* working jaccard

* docstrings for jaccard

* small improve

* typing

* fix doctest

* try something

* Apply suggestions from code review

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Stancl <[email protected]>
Co-authored-by: Justus Schock <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
@SkafteNicki SkafteNicki mentioned this pull request Aug 28, 2022
4 tasks
Borda added a commit that referenced this pull request Sep 12, 2022
* base structure

* bincount

* binary

* files

* stat score

* multiclass + multilabel confmat

* update

* stat_score

* change bincount

* move back

* del tests

* rest of structure

* confmat working

* working binary stat scores

* full testing

* update

* update

* add missing tests

* update

* multilabel stat scores

* disable old testing

* more testing

* flaky tests

* changelog

* refactor

* class interface

* fixes

* typing

* update

* fix tests

* Update src/torchmetrics/functional/classification/confusion_matrix.py

* missing literal

* add docstring to functional confusion matrix

* add docstring to modular confusion matrix

* add docstring to functional stat scores

* add docstring to modular stat scores

* make private

* docs

* fix mypy and doctests

* fix docs formatting

* literal backwards

* custom movedim

* docs

* inits

* fix

* fix mistakes

* working cohen kappa

* Delete speed.py

* cohen kappa done

* working matthews

* working jaccard

* docstrings for jaccard

* small improve

* typing

* fix doctest

* try something

* Apply suggestions from code review

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Stancl <[email protected]>
Co-authored-by: Justus Schock <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Borda added a commit that referenced this pull request Sep 12, 2022
* base structure

* bincount

* binary

* files

* stat score

* multiclass + multilabel confmat

* update

* stat_score

* change bincount

* move back

* del tests

* rest of structure

* confmat working

* working binary stat scores

* full testing

* update

* update

* add missing tests

* update

* multilabel stat scores

* disable old testing

* more testing

* flaky tests

* changelog

* refactor

* class interface

* fixes

* typing

* update

* fix tests

* Update src/torchmetrics/functional/classification/confusion_matrix.py

* missing literal

* add docstring to functional confusion matrix

* add docstring to modular confusion matrix

* add docstring to functional stat scores

* add docstring to modular stat scores

* make private

* docs

* fix mypy and doctests

* fix docs formatting

* literal backwards

* custom movedim

* docs

* inits

* fix

* fix mistakes

* working cohen kappa

* Delete speed.py

* cohen kappa done

* working matthews

* working jaccard

* docstrings for jaccard

* small improve

* typing

* fix doctest

* try something

* Apply suggestions from code review

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Stancl <[email protected]>
Co-authored-by: Justus Schock <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Borda added a commit that referenced this pull request Sep 13, 2022
* base structure

* bincount

* binary

* files

* stat score

* multiclass + multilabel confmat

* update

* stat_score

* change bincount

* move back

* del tests

* rest of structure

* confmat working

* working binary stat scores

* full testing

* update

* update

* add missing tests

* update

* multilabel stat scores

* disable old testing

* more testing

* flaky tests

* changelog

* refactor

* class interface

* fixes

* typing

* update

* fix tests

* Update src/torchmetrics/functional/classification/confusion_matrix.py

* missing literal

* add docstring to functional confusion matrix

* add docstring to modular confusion matrix

* add docstring to functional stat scores

* add docstring to modular stat scores

* make private

* docs

* fix mypy and doctests

* fix docs formatting

* literal backwards

* custom movedim

* docs

* inits

* fix

* fix mistakes

* working cohen kappa

* Delete speed.py

* cohen kappa done

* working matthews

* working jaccard

* docstrings for jaccard

* small improve

* typing

* fix doctest

* try something

* Apply suggestions from code review

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Stancl <[email protected]>
Co-authored-by: Justus Schock <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Borda added a commit that referenced this pull request Sep 13, 2022
* base structure

* bincount

* binary

* files

* stat score

* multiclass + multilabel confmat

* update

* stat_score

* change bincount

* move back

* del tests

* rest of structure

* confmat working

* working binary stat scores

* full testing

* update

* update

* add missing tests

* update

* multilabel stat scores

* disable old testing

* more testing

* flaky tests

* changelog

* refactor

* class interface

* fixes

* typing

* update

* fix tests

* Update src/torchmetrics/functional/classification/confusion_matrix.py

* missing literal

* add docstring to functional confusion matrix

* add docstring to modular confusion matrix

* add docstring to functional stat scores

* add docstring to modular stat scores

* make private

* docs

* fix mypy and doctests

* fix docs formatting

* literal backwards

* custom movedim

* docs

* inits

* fix

* fix mistakes

* working cohen kappa

* Delete speed.py

* cohen kappa done

* working matthews

* working jaccard

* docstrings for jaccard

* small improve

* typing

* fix doctest

* try something

* Apply suggestions from code review

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Stancl <[email protected]>
Co-authored-by: Justus Schock <[email protected]>
Co-authored-by: Jirka Borovec <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Priority Critical task/issue ready refactoring refactoring and code health
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants